package com.jacky.dubbo3.filters;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.filter.ClusterFilter;

import java.util.Map;

@Activate(group = {CommonConstants.CONSUMER})
public class GrayTagFilter implements ClusterFilter {
    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        Map<String, String> parameters = invoker.getUrl().getParameters();
        System.out.println("===== url:" + invoker.getUrl() + " =====");
        System.out.println("===== url params:" + parameters + " =====");
        return invoker.invoke(invocation);
    }
}
